Skip to content

feat(miners): unbound OPEN issues when since is omitted#27

Merged
LandynDev merged 1 commit into
testfrom
fix/unbounded-open-issues-when-no-since
May 11, 2026
Merged

feat(miners): unbound OPEN issues when since is omitted#27
LandynDev merged 1 commit into
testfrom
fix/unbounded-open-issues-when-no-since

Conversation

@anderdc
Copy link
Copy Markdown
Collaborator

@anderdc anderdc commented May 10, 2026

Summary

  • When since is provided, behavior is unchanged: OPEN issues created_at >= since plus CLOSED issues closed_at >= since (the scoring window).
  • When since is omitted, the response now contains all currently-OPEN issues with no time bound and no CLOSED history.

Lets callers asking for "current open-issue load" stop using a synthetic epoch-since workaround that fetches a full all-time payload.

Why

Mirror clients currently have to pass since=<35 days ago> for issue-discovery scoring AND a second since=<epoch> request to count current open-issue load — because OPEN issues older than the scoring window are otherwise invisible. The downstream consumer is the validator's open-issue spam multiplier (see entrius/gittensor#929 / PR #930): a miner with open issues older than 35 days currently gets a free pass on the spam gate.

Two cleaner alternatives I considered:

  • Add an open_issue_count sidecar field to the response. Workable but requires both endpoint and consumer to teach a new field.
  • Drop the since filter on OPEN unconditionally. Breaks the documented "issues since X" contract for scoring callers.

The since-aware behavior here keeps both contracts coherent: presence of since = scoring window, absence of since = open-issue load snapshot.

Diff

packages/das/src/api/miners/miners.service.ts

  • getIssues accepts since: string | null, response shape's since is now string | null.
  • SQL OPEN branch wraps the date filter in ($2::timestamptz IS NULL OR i.created_at >= $2). When $2 is null the short-circuit returns TRUE and all OPEN rows match; CLOSED branch's i.closed_at >= $2 evaluates null and yields no rows.

packages/das/src/api/miners/miners.controller.ts

  • Issues route passes since ?? null through instead of calling MinersService.resolveSince(since). The PR route is untouched.
  • Swagger summary/description/since docs updated to reflect both modes.

MinersService.resolveSince stays — still used by the PR route.

Test plan

  • Existing scoring callers (since=<date>) get the same OPEN+CLOSED window as before — SQL plan unchanged when $2 is non-null.
  • Omitting since returns all OPEN issues across all repos the mirror tracks, no CLOSED rows.
  • Reviewer: spot-check the SQL planner picks the author_github_id index for the no-since case (should be the same access path; the OPEN filter degenerates to a constant).
  • Reviewer: confirm no other internal callers of getIssues rely on the prior string (non-null) parameter shape.

Related

When `since` is provided, behavior is unchanged: OPEN created on/after,
CLOSED closed on/after — the scoring window.

When `since` is omitted, the response now returns all currently-OPEN
issues with no time bound and no CLOSED history. Callers asking for
"current open-issue load" no longer need a synthetic epoch-since
workaround that pulls a full all-time payload.

Lets the validator's open-issue spam-multiplier count old still-open
issues that fall outside the scoring lookback window — the gap called
out in entrius/gittensor#929 / PR #930.
@xiao-xiao-mao xiao-xiao-mao Bot added the enhancement New feature or request label May 10, 2026
@LandynDev LandynDev merged commit 56cb417 into test May 11, 2026
2 checks passed
@anderdc anderdc deleted the fix/unbounded-open-issues-when-no-since branch May 11, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants